package com.boot.security.config;

import io.jsonwebtoken.SignatureAlgorithm;
import io.jsonwebtoken.security.Keys;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

import java.security.KeyPair;

/**
 * @author 霜寒 <1621856595@qq.com>
 * @description 加密解密配置
 * @date 2020/5/22 15:15
 **/
@Configuration
public class SecretAutoConfiguration {

    @Bean
    public KeyPair createKey() {
        return Keys.keyPairFor(SignatureAlgorithm.RS512);
    }

    @Bean
    public PasswordEncoder passwordEncoder() {
        return new BCryptPasswordEncoder();
    }

}
